package cn.edu.neusoft.demo.hospital2.Service.impl;

import cn.edu.neusoft.demo.hospital2.Dao.MedicalRecordDao;
import cn.edu.neusoft.demo.hospital2.Service.MedicalRecordService;
import cn.edu.neusoft.demo.hospital2.pojo.MedicalRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class MedicalRecordServiceImpl implements MedicalRecordService {

    @Autowired
    private MedicalRecordDao medicalRecordDao;

    @Override
    public List<MedicalRecord> getAllRecords() {
        return medicalRecordDao.getAllRecords();
    }

    @Override
    public MedicalRecord getRecordById(Integer recordId) {
        return medicalRecordDao.getRecordById(recordId);
    }

    @Override
    public int addRecord(MedicalRecord medicalRecord) {
        return medicalRecordDao.insert(medicalRecord);
    }

    @Override
    public int updateRecord(MedicalRecord medicalRecord) {
        return medicalRecordDao.updateById(medicalRecord);
    }

    @Override
    public int deleteRecordById(Integer recordId) {
        return medicalRecordDao.deleteById(recordId);
    }
}
